package cn.lxh.ymcc.feign;

import cn.lxh.ymcc.doc.CourseDoc;
import cn.lxh.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class SearchFeignClientFallBackFactory implements FallbackFactory<SearchFeignClient> {

    @Override
    public SearchFeignClient create(Throwable e) {
        return new SearchFeignClient() {
            @Override
            public JSONResult saveCourse(CourseDoc doc) {
                e.printStackTrace();
                return JSONResult.error("新增豪猪触发");
            }

            /**
             * 删除的熔断
             * @param doc
             * @return
             */
            @Override
            public JSONResult deleteCourse(CourseDoc doc) {
                e.printStackTrace();
                return JSONResult.error("删除熔断触发");
            }
        };
    }
}
